#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int dominantIndex(int* nums, int numsSize) {
    int i = 0;
    int tmp = nums[0];
    int key = 0;
    for (i = 1; i < numsSize; i++)
    {
        if (tmp < nums[i])
        {
            key = i;
            tmp = nums[i];
        }
    }

    for (i = 0; i < numsSize; i++)
    {
        if (tmp < (nums[i] * 2) && (i != key))
        {
            return -1;
        }
    }
    return key;
}
int main()
{
    int arr[4] = { 1,2,3,4 };
    printf("%d\n", dominantIndex(arr,4));

	return 0;
}